package com.xiaobai.shardingsphere.controller;

import com.xiaobai.shardingsphere.entity.UserVO;
import com.xiaobai.shardingsphere.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserMapper userMapper;

    @RequestMapping("/insert")
    public int insert(UserVO userVO) {
        userVO.setPhone("123456");
        userVO.setStatus("1");
        userVO.setUserName("小米");
        return userMapper.insertUser(userVO);
    }

    @RequestMapping("/findOrderByIds")
    public List<Map<String, Object>> findOrderByIds(List<Long> orderIds) {
        return userMapper.selectUserbyIds(orderIds);
    }

    @RequestMapping("/list")
    public List<Map<String, Object>> list() {
        return userMapper.list();
    }
}
